function hyk = Hyk(Test, Trains, numOfClass, numOfTrain)
    N = numOfClass * numOfTrain;
    dj = zeros(N,1);
    for i = 1:N
        dj(i,1) = Distance(Test, Trains(:,i));
    end
    d = mean(dj,1);
    uj = zeros(N,1);
    for j = 1:N
        uj(j) = 1 / (1 + dj(j,1) / d);
    end
    hyk = zeros(numOfClass, 1);
    Nk = numOfTrain;
    for k = 1:numOfClass
        for j = 1:numOfTrain
            hyk(k) = hyk(k) + uj((k - 1) * numOfTrain + j, 1);
        end
        hyk(k) = hyk(k) / Nk;
    end
    hyk = hyk';
end


